package cn.coisini.api.admin;

import cn.coisini.model.common.dtos.Result;
import cn.coisini.model.common.enums.ResultEnum;
import cn.coisini.model.common.enums.SmsType;
import cn.coisini.model.dto.UserDto;
import cn.coisini.security.auth.AuthUser;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;

/**
 * @author xiangshaw
 * Description: 用户认证接口
 */
@Tag(name = "用户认证", description = "用户认证、注册、获取验证码、are you ok")
@RequestMapping("/api/v1/auth")
public interface AuthenticationControllerApi {

    @Operation(summary = "用户信息查询")
    @GetMapping("/userInfo")
    Result<Map<String, Object>> userInfo();

    @Operation(summary = "用户注册")
    @PostMapping("/register")
    Result<ResultEnum> register(@RequestBody UserDto userDto);

    @Operation(summary = "用户认证")
    @PostMapping("/authenticate")
    Result<String> authenticate(@RequestBody AuthUser authUser, HttpServletRequest request) throws IOException;

    @Operation(summary = "获取验证码")
    @GetMapping("/captcha")
    Result<Map<String, Object>> captcha() throws IOException;

    @Operation(summary = "发送邮箱/短信验证码")
    @PostMapping("/sendSms")
    Result<ResultEnum> sendSms(@RequestParam String mode, @RequestParam SmsType smsType);

    @Operation(summary = "用户退出登录")
    @PostMapping("/logout")
    Result<ResultEnum> logout();

    @Operation(summary = "are you ok")
    @PostMapping("/hello")
    Result<String> hello();
}
